<template>
   <div>
     <div class="verification">
       <p>你的登录名</p>
       <input type="text" placeholder="点击输入登录名" class="name" v-model="loginName" />
       <p class="pw">你的密码</p>
       <input type="text" placeholder="点击输入密码" class="password" v-model="password" />
       <v_button @click.native="st_login"></v_button>
     </div>
   </div>
</template>

<script>
  import v_button from '@/components/public/button'
    export default {
      name:'st_login',
      components: {
        v_button:v_button
      },
      data:function () {
        return{
          loginName:'',
          password:''
        }
      },
      methods:{
        st_login:function () {
           if(this.loginName==""){
             this.$layer.msg("登录名不能为空",{time:1});
             return;
           }
           if(this.password==""){
             this.$layer.msg("密码不能为空",{time:1});
             return;
           }
           var load1=this.$layer.loading(2);
           this.$http.post("http://192.168.10.53:8068/WefService/mif/mLogin_loginStu.do",{loginName:this.loginName,password:this.password},{emulateJSON:true,credentials: true}).then(
             function (res) {
               var resdata=JSON.parse(resdata.bodyText);
               this.$layer.close(load1);
               this.$layer.msg(resdata.message,{time:1});
               if(resdata.status==1){
                 sessionStorage.setItem('fpId',obj.fpId);
                 sessionStorage.setItem('code',obj.code);
                 sessionStorage.setItem('ridgepole',obj.ridgepole);
                 sessionStorage.setItem('unit',obj.unit);
                 sessionStorage.setItem('areaType',obj.areaType); //学生1
                 sessionStorage.setItem('areaId',obj.area);//所属区域id
                 var areaType = sessionStorage.getItem('areaType');
                 sessionStorage.setItem('userName',loginName);
                 sessionStorage.setItem('noRead',obj.letterNum);
                 sessionStorage.setItem('actualName',obj.name);
                 var noRead = sessionStorage.getItem('noRead');
                 this.$router.push({path:'/payHistory'});
               }
             },function (res) {
               this.$layer.close(load1);
               var resdata=JSON.parse(res.bodyText);
               this.$layer.msg(resdata.info,{time:1});
             }
           );
        },
        mounted:function () { //渲染模板
          this.st_login();
        }
      }
    }
</script>

<style scoped>
  .verification{
    padding:.9rem .16rem 0 .16rem;
    background-color: #fff;
  }
  .verification p{
    font-size: .18rem;
    text-align: left;
    color: #444;
  }
  .verification input{
    border: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    width: 100%;
    line-height: .5rem;
    color: #444;
    font-size: .12rem;
    display: inline-block;
    border-bottom: 1px solid #eee;
  }
  .pw{
    margin-top: .3rem;
  }
  .password{
    margin-bottom: .4rem;
  }
</style>
